package com.z996.spring6.pojo;

import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 简述:<br>
 * 用户类
 *
 * @Author zfh18
 * @Date 2024-02-29 18:49
 * @Version 1.0
 **/
@Data
public class User {
    private Logger logger = LoggerFactory.getLogger(User.class);
    private Integer id;

    private String username;

    private String password;

    private Integer age;

    private Teacher teacher;

    public User() {
        logger.info("生命周期:①-->调用无参构造来创建对象");
        logger.info("生命周期:②中设置对象属性或依赖注入,按照定义xml property 顺序来进行赋值");
    }

    public void setId(Integer id) {
        logger.info("生命周期:②-->设置对象属性值");
        this.id = id;
    }

    public void setTeacher(Teacher teacher) {

        logger.info("生命周期:②-->设置对象属性值-依赖注入");
        this.teacher = teacher;
    }

    public void initMethod() {
        logger.info("生命周期:④-->初始化方法");
    }

    public void destroyMethod() {
        logger.info("生命周期:⑥-->销毁方法");
    }
}
